home *** CD-ROM | disk | FTP | other *** search
- /*
- Patch IPrefs to use 8192 bytes stack instead of 3500 bytes
-
- Written by Jorma Oksanen <tenu@sci.fi>
- */
-
- address command
- call pragma('D','SYS:C')
-
- /* Read code into variable
- */
-
- if ~open(in,'IPrefs','r') then exit
- code=readch(in,60000)
- call readch(in,1); if ~eof(in) then exit
- call close(in)
-
- /* Patch stack size
-
- for Wb3.x
-
- 4878 0DAC PEA 3500.w
- 2F3C 8000 03F3 MOVE.L NP_StackSize,-(SP)
-
- or for Wb2.x
-
- 2B7C 8000 03F3 xxxx MOVE.L NP_StackSize,xxxx(a5)
- 2B7C 0000 0BB8 xxxx MOVE.L #3000,xxxx(a5)
-
- */
-
- i=pos('4878 0DAC 2F3C 8000 03F3'x,code)
- if i>0 then code=overlay('2000'x,code,i+2)
-
- else do
- i=pos('2B7C 8000 03F3'x,code); if i=0 then exit
- j=pos('2B7C 0000 0BB8'x,code,i); if j~=i+8 then exit
- code=overlay('2000'x,code,j+4)
- end
-
- /* Patch version string
- */
-
- i=pos('$VER:',code)
- if i>0 then do
- j=pos('.',code,i); if j=0 then break
- i=pos(' ',code,j); if i=0 then break
- rev=substr(code,j+1,i-j-1)
- code=overlay(rev+1,code,j+1)
- end
-
- /* Write out new version
- */
-
- if ~open(out,'IPrefs.new','w') then exit
- if writech(out,code)~=length(code) then exit
- call close(out)
-
- /* Complete patch by renaming files
- */
-
- 'rename IPrefs as IPrefs.orig'
- 'rename IPrefs.new as IPrefs'
-
- say 'IPrefs succesfully patched.'
- say 'Original backed up as IPrefs.orig'
- say
-
-